package com.lin.controller;

import com.lin.response.CommonResp;
import com.lin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class LoginController {

    @Autowired
    private UserService userService;

    @GetMapping("/login")
    public CommonResp Login(@RequestParam String name, @RequestParam String password){
        return userService.Login(name,password);
    }

    @GetMapping("/register")
    public CommonResp Register(@RequestParam String name, @RequestParam String password, @RequestParam String username, @RequestParam String studentNo){
        return userService.Register(name,password,username,studentNo);
    }
}
